package com.healthcarex.hip.saas.security.model;


import com.healthcarex.hip.saas.common.model.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
 * @author chenpan
 * @ClassName: SysUser
 * description:
 * @date 2018-04-02 14:05
 */
@Table(name = "HP_SYS_USER")
@Data
@ToString(callSuper = true)
@ApiModel(value = "SysUser", description = "用户信息")
public class SysUser extends BaseModel {

    /**
     * 账户有效
     */
    public static final String STATUS_VALID = "1";
    /**
     * 账户锁定
     */
    public static final String STATUS_LOCK = "0";

    public static final String DEFAULT_THEME = "darkBlue";

    public static final String DEFAULT_AVATAR = "default.jpg";

    @ApiModelProperty("用户名")
    @Column(name = "USERNAME")
    @NotBlank(message = "{user.username.notBlank}")
    private String username;

    @ApiModelProperty("昵称/姓名")
    @Column(name = "NICK_NAME")
    @NotBlank
    private String nickName;

    @ApiModelProperty("密码")
    @Column(name = "PASSWORD")
    private String password;

    @ApiModelProperty("性别编码")
    @Column(name = "GENDER_CODE")
    @NotBlank
    private String genderCode;

    @ApiModelProperty("性别名称")
    @Column(name = "GENDER_NAME")
    private String genderName;

    @ApiModelProperty("登录科室编码")
    @Column(name = "LOGIN_DEPT_CODE")
    private String deptCode;

    @ApiModelProperty(value = "科室名称", hidden = true)
    @Transient
    private String deptName;

    @ApiModelProperty("登录机构编码")
    @Column(name = "LOGIN_ORG_CODE")
    private String orgCode;

    @ApiModelProperty(value = "机构名称", hidden = true)
    @Transient
    private String orgName;

    @ApiModelProperty("邮箱")
    @Column(name = "EMAIL")
    private String email;

    @ApiModelProperty("电话")
    @Column(name = "PHONE")
    private String phone;

    @ApiModelProperty("账号状态")
    @Column(name = "STATUS")
    @NotBlank
    private String status;

    @ApiModelProperty("上次登录时间")
    @Column(name = "LAST_LOGIN_TIME")
    private Date lastLoginTime;

    @ApiModelProperty("主题")
    @Column(name = "THEME")
    private String theme;

    @ApiModelProperty("图像")
    @Column(name = "AVATAR")
    private String avatar;

    @ApiModelProperty("备注")
    @Column(name = "DESCRIPTION")
    private String description;

}
